<?php
/**
 * Created by novebeta.
 * Date: 12/4/12
 * Time: 10:01 PM
 */
Yii::import('ext.portlet.XPortlet');
class menuKanan extends XPortlet
{
    //public $galeri = array();
    protected function renderContent()
    { 
       /*berita*/ 
       $criteria_berita=new CDbCriteria();
       $criteria_berita->addCondition('kategori="0"');
       $criteria_berita->order='id desc'; 
       $criteria_berita->limit='3';    
       $count=Berita::model()->count($criteria_berita); 
       $pages = new CPagination($count);
        // results per page
        $pages->pageSize = 3;
        $pages->applyLimit($criteria_berita);
        
        
        /*pengajian*/ 
       $criteria_pengajian=new CDbCriteria();
       $criteria_pengajian->select='penceramah';
       $criteria_pengajian->distinct=true;
       $criteria_pengajian->order='id_pengajian asc'; 
       //$criteria_pengajian->limit='10';    
       //$count=pengajian::model()->count($criteria_pengajian); 
      // $pages = new CPagination($count);
      //  // results per page
      //  $pages->pageSize = 3;
       // $pages->applyLimit($criteria_berita);
        
        
       $models_pengajian=Pengajian::model()->findAll($criteria_pengajian);   
	   $models_berita=Berita::model()->findAll($criteria_berita);       
       $this->render('menuKanan',array(    
       'model_berita'=>$models_berita, 
       'count'=>$count ,
       'pages' => $pages,       
       'model_pengajian'=>$models_pengajian,    
		));
      
    }
}
